package org.example.consumer;

import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;

public class Java8Consumer3 {
    public static void main(String[] args) {
        List<String> list = Arrays.asList("a", "ab", "abc");
        forEach(list,x -> System.err.println(x.length()));
    }

    static <T> void forEach(List<T> list, Consumer<T> consumer){
        for (T t : list) {
            consumer.accept(t);
        }
    }
}
